home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / DoorPivotSwitchPivot.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.4 KB  |  73 lines

  1. public class DoorPivotSwitchPivot extends Codex {
  2.    private float _duration = 3.0F;
  3.    private float _openTime;
  4.    private CodexThing _switchThing;
  5.    private CodexThing door;
  6.    private int doorGuid;
  7.    private boolean bOpen;
  8.    private boolean bActive;
  9.    private boolean bSwitchActive;
  10.    public static String[] _params = new String[]{"Duration;3.0", "Switch Time;0", "Switch"};
  11.  
  12.    public void clicked(int guid, int clickerGuid, int captureId) {
  13.       if (!this.bActive && !this.bSwitchActive) {
  14.          if (guid == this.doorGuid) {
  15.             new CodexSound("locked_large_02.WAV", 300.0F, 600.0F, 100, 0, 0, clickerGuid);
  16.             CodexConsole.PrintNLS(clickerGuid, 0, "GEN_OPENELSEWHERE");
  17.          } else {
  18.             this.bActive = true;
  19.             if (!this.bOpen) {
  20.                this._switchThing.RotatePivot(1, this._openTime);
  21.                this.door.RotatePivot(1, this._duration);
  22.                this.bOpen = true;
  23.             } else {
  24.                this._switchThing.RotatePivot(1, -this._openTime);
  25.                this.door.RotatePivot(1, -this._duration);
  26.                this.bOpen = false;
  27.             }
  28.  
  29.          }
  30.       }
  31.    }
  32.  
  33.    public void beginscene(int clientGuid, int captureID) {
  34.       this.door.SetThingFlags(8192);
  35.    }
  36.  
  37.    public void arrived(int thingGuid, int frameNum, int captureId) {
  38.       if (thingGuid == this.door.GetGUID()) {
  39.          this.bActive = false;
  40.       }
  41.  
  42.       if (thingGuid == this._switchThing.GetGUID()) {
  43.          this.bSwitchActive = false;
  44.       }
  45.  
  46.    }
  47.  
  48.    public void restore(int flags) {
  49.       this.bOpen = CodexSequence.RestoreBoolean();
  50.    }
  51.  
  52.    public DoorPivotSwitchPivot(float duration, float openTime, CodexThing switchThing) {
  53.       this._duration = duration;
  54.       this._openTime = openTime;
  55.       this._switchThing = new CodexThing(((Codex)switchThing).GetGUID());
  56.       ((Codex)this).CaptureThing(this._switchThing.GetGUID());
  57.       this.doorGuid = ((Codex)this).GetClassThing();
  58.       this.door = new CodexThing(this.doorGuid);
  59.       if (this.door.GetDescriptionID().equalsIgnoreCase("PROP")) {
  60.          this.door.SetDescriptionID("GEN_DOOR");
  61.       }
  62.  
  63.       if (this._switchThing.GetDescriptionID().equalsIgnoreCase("PROP")) {
  64.          this._switchThing.SetDescriptionID("GEN_SWITCH");
  65.       }
  66.  
  67.    }
  68.  
  69.    public void save(int flags) {
  70.       CodexSequence.SaveBoolean(this.bOpen);
  71.    }
  72. }
  73.